package com.ning.ems.util;

import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @author Ning 242741154@qq.com
 * @date 2020/4/11 17:56
 */
public class Util {
    public static Integer zeroToNull(Integer integer) {
        if (integer == null) {
            return null;
        }
        return (integer == 0 ? null : integer);
    }

    public static <T, R> List<R> mapping(List<T> list, Function<T, R> mapper) {
        return list.stream().map(mapper).collect(Collectors.toList());
    }
}
